package com.opentd.npc;

import javax.swing.SwingWorker;

public class WaveTimer extends SwingWorker{

	private long startTime;
	private int timeLeft;
	private boolean isReady;
	
	@Override
	protected Object doInBackground() throws Exception {
		startTime = System.currentTimeMillis();
		
		while(System.currentTimeMillis() - startTime <= 10000){
			//System.out.println("Time elapsed: " + (System.currentTimeMillis() - startTime));
			timeLeft = 10 - (int) ((System.currentTimeMillis() - startTime) / 1000);
		}
		isReady = true;
		return null;
	}
	
	public int getTimeLeft(){
		return timeLeft;
	}
	
	public boolean isReady(){
		return isReady;
	}
	
	

}
